package edu.zut.cs.software.example.shop.service.impl;

import java.awt.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.zut.cs.software.example.service.impl.GenericManagerImpl;
import edu.zut.cs.software.example.shop.dao.ShopDao;
import edu.zut.cs.software.example.shop.domin.Shop;
import edu.zut.cs.software.example.shop.service.ShopManager;
/**
* @author zhangyingpeng
*
*/

@Service
public class ShopManagerImpl extends GenericManagerImpl<Shop, Long> implements ShopManager {
	ShopDao shopDao;
	@Autowired
	  public void setShopDao(ShopDao shopDao) {
		this.shopDao=shopDao;
		this.dao=this.shopDao;
	}
	
	@Override
	public Shop ShopService(Shop shop) {
		// TODO Auto-generated method stub
		return shopDao.getAllShop(shop.getShopID());
	}
	@Override
	public int deleteShopID(String shopID) {
		int i=shopDao.deleteShopID(shopID);
		return i;
	}
	@Override
	public List getShop(String shopname, int pagenum, int pageSize) {
		List Shop= (List) shopDao.getShop(shopname, pagenum, pageSize);
		return Shop;
	}

	@Override
	public Shop getUpdateShop(int id) {
		return shopDao.getUpdateShop(id);
		
	}
	
	@Override
	public int editShop(Shop shop) {
		String shopname=shop.getShopname();
		String shopaddress=shop.getShopaddress();
		String shopID=shop.getShopID();
		Long ID=shop.getId();
		return shopDao.editShop(shopname,shopaddress,shopID,ID);
	}

	@Override
	public int getShopCounts(String shopname) {
		int p = shopDao.getShopCounts(shopname);
		return p;
	}
}
